---
title: Charmhub | Deploy Gunicorn using Charmhub - The Open Operator Collection
description: Deploy the latest version of Gunicorn as a Kubernetes Operator on any
  cloud.
url: https://charmhub.io/gunicorn-k8s/docs/Use a custom dockerfile
---

# Gunicorn

[Franco Luciano Forneron Buschiazzo](https://charmhub.io/publisher/gtrkiller "View all packages from Franco Luciano Forneron Buschiazzo")

* [Franco Luciano Forneron Buschiazzo](https://charmhub.io/publisher/gtrkiller "View all packages from Franco Luciano Forneron Buschiazzo")

Platform:

stable 45

```
juju deploy gunicorn-k8s
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Homepage](https://github.com/canonical/gunicorn-k8s-operator/)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

## How to use a custom dockerfile tutorial

Prerequisites:

* A working station, e.g., a laptop.
* [Juju and Microk8s](https://juju.is/docs/olm/microk8s) installed
* [Docker](https://snapcraft.io/docs/installing-snap-on-ubuntu) snap installed

For practicality, we strongly advice you to enable microk8s’ registry to push docker images to a local registry
(the tutorial will be made with this registry), and you’ll also need ingress to be enabled for this tutorial:

```
microk8s enable ingress registry
```

Lets deploy anbox-cloud.io page on a local charm.

First, you need to download the anbox-cloud repo by executing the next command:

```
git clone https://github.com/canonical/anbox-cloud.io.git
```

Then, change the current directory to the repo’s folder and execute the following to build the docker image and push it to the registry:

```
DOCKER_BUILDKIT=1 docker build . -t localhost:32000/anbox:latest -f Dockerfile --no-cache
docker push localhost:32000/anbox:latest
```

Then you should add a model to your k8s-controller in juju and deploy both gunicorn-k8s and nginx-ingress-integrator supplying some extra parameters:

```
juju add-model gunicorndepl
juju deploy gunicorn-k8s \
  --resource gunicorn-image='localhost:32000/anbox:latest' \
  --config startup_command='talisker.gunicorn.gevent webapp.app:app --bind 0.0.0.0:8080 --worker-class gevent --name talisman-`hostname`' \
  --config environment='SECRET_KEY: 12345'
juju deploy nginx-ingress-integrator ingress
juju relate gunicorn-k8s ingress
```

Then, edit your `/etc/hosts` file, adding the following line:

```
{Your ingress IP} anbox-local
```

If you don’t know your Ingress IP, you can use the following command to learn it:

```
microk8s kubectl get pods -n ingress -o wide
```

This way, when you browse anbox-local it will resolve to your ingress service IP.
Now, browse to <http://anbox-local> and you’ll see the web page deployed.

---
